package com.monkey.toolsshop.user.dao.entity;

import com.monkey.toolsshop.common.dao.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * 用户主体表
 * */
@Entity
@Table(name="user_entity",
        indexes={@Index(name="idx_username_type_status_index",columnList="username,user_type,user_status")})
public class UserEntity extends BaseEntity {

    /**
     * 用户名
     * */
    @Column(name = "username", length = 128, nullable = false, unique = true)
    @Setter @Getter
    private String username;

    /**
     * 密码
     * */
    @Column(name = "password", length = 128, nullable = false)
    @Setter @Getter
    private String password;

    /**
     * 用户显示名称
     * */
    @Column(name = "display_name", length = 128, nullable = false)
    @Setter @Getter
    private String displayName;

    /**
     * 用户类型
     * {@link com.monkey.toolsshop.user.enums.EnumUserType}
     * */
    @Column(name = "user_type", length = 2, columnDefinition="tinyint default 0")
    @Setter @Getter
    private Integer userType;

    /**
     * 用户状态枚举类型
     * {@link com.monkey.toolsshop.user.enums.EnumUserStatus}
     * */
    @Column(name = "user_status",  length = 2, columnDefinition="tinyint default 0")
    @Setter @Getter
    private Integer userStatus;

    @Column(name = "user_tel", length = 128, nullable = false)
    @Setter @Getter
    private String userTel;

    @Column(name = "user_mail", length = 128, nullable = false)
    @Setter @Getter
    private String userMail;

    @Column(name = "user_photo", length = 128, nullable = false)
    @Setter @Getter
    private String userPhoto;
}